#ifndef _GEN_GAME_STATE_H_
#define _GEN_GAME_STATE_H_

namespace LuaPlus
{
	class LuaState;
}

#include "mat_game.h"

#include "input/keyboard.h"
#include "gameflow/ui_state.h"
#include "math/counter.h"


namespace gameflow
{
	class UIPopup;
}

class MATUIHelper;

class GENGameState : public gameflow::UIState 
{
public:
						GENGameState(camera::FbCamera*	pCamera, const std::string& UI, const std::string& OnEnter, const std::string& OnExit);
	virtual				~GENGameState();

	/// called when the game flow manager transitions into this game state
	virtual	bool		OnEnter();

	/// called when the game flow manager transitions out of this game state
	virtual	bool		OnExit();

	/// render the help
	virtual	bool		PreRender();
	virtual	bool		PostRender();

	/// update the game
	virtual	bool		Tick(float dt);
	virtual void		KeyDown(input::Keyboard::KEY* pKey);
	virtual void		KeyPressed(input::Keyboard::KEY* pKey);
	virtual	void		MouseButtonPressed(input::Mouse::BUTTON_STATE* pKey, const math::Vec2& Pos);
	virtual	void		MouseButtonReleased(input::Mouse::BUTTON_STATE* pKey, const math::Vec2& Pos);
	virtual	void		MouseButtonDown(input::Mouse::BUTTON_STATE* pKey, const math::Vec2& Pos);
	virtual void		MouseMove(const math::Vec2& From, const math::Vec2& To);
	virtual void		MouseWheelMove(int WheelInfo, const math::Vec2& Pos);
	virtual void		LoseFocus();
    

	static GENGameState*	GetGame();
		
	void					Load(const std::string& File);
	void					Save(const std::string& File);

	static void				Register(LuaPlus::LuaState* _pScript);	
	MATGame*				GetGameMatch5();

protected:

	void DELEGATE_CALL				OnButtonPause(ui::UIWidget::WIDGET_EVENT Event, ui::UIWidget* pWidget);
	void DELEGATE_CALL				OnButtonAchievement(ui::UIWidget::WIDGET_EVENT Event, ui::UIWidget* pWidget);
	
	bool							m_IsDebugging;


	bool							m_IsConstantScreenShot;
	int								m_ConstantScreenShotIndex;
	bool							m_ToSkipConstantScreenShot;
	
	MATGame*						m_pGame;
	std::vector<MATUIHelper*>		m_pButtons;

	int								m_FPS;
	int								m_FPSTemp;
	math::Counter					m_FPSCounter;
	bool							m_IsLoaded;
	std::string						m_FileToLoad;   
	

};


#endif //_GEN_PUZZLE_STATE_H_
